/* 
 * ctype.h
 * This file has no copyright assigned and is placed in the Public Domain.
 * This file is a part of the clang port package.
 * No warranty is given; refer to the file DISCLAIMER within the package.
 *
 * Functions for testing character types and converting characters.
 *
 */

#ifndef _CLANG_PORT_CTYPE_H_
#define _CLANG_PORT_CTYPE_H_

/* All the headers include this file. */
#ifndef __IMPL_CLANG_PORT_API_
#	include <_clang_port.h>
#else
#	include <include/_clang_port.h>
#endif

#ifdef __cplusplus
extern "C" {
#endif

/* 
 * Clang Hook Api.
*/
typedef int CLANG_PORT_FPTR_TYPE(isalnum)(int);
extern CLANG_PORT_FPTR_VAR(isalnum);
typedef int CLANG_PORT_FPTR_TYPE(isalpha)(int);
extern CLANG_PORT_FPTR_VAR(isalpha);
typedef int CLANG_PORT_FPTR_TYPE(isascii)(int);
extern CLANG_PORT_FPTR_VAR(isascii);
typedef int CLANG_PORT_FPTR_TYPE(isblank)(int);
extern CLANG_PORT_FPTR_VAR(isblank);
typedef int CLANG_PORT_FPTR_TYPE(iscntrl)(int);
extern CLANG_PORT_FPTR_VAR(iscntrl);
typedef int CLANG_PORT_FPTR_TYPE(isdigit)(int);
extern CLANG_PORT_FPTR_VAR(isdigit);
typedef int CLANG_PORT_FPTR_TYPE(isgraph)(int);
extern CLANG_PORT_FPTR_VAR(isgraph);
typedef int CLANG_PORT_FPTR_TYPE(islower)(int);
extern CLANG_PORT_FPTR_VAR(islower);
typedef int CLANG_PORT_FPTR_TYPE(isprint)(int);
extern CLANG_PORT_FPTR_VAR(isprint);
typedef int CLANG_PORT_FPTR_TYPE(ispunct)(int);
extern CLANG_PORT_FPTR_VAR(ispunct);
typedef int CLANG_PORT_FPTR_TYPE(isspace)(int);
extern CLANG_PORT_FPTR_VAR(isspace);
typedef int CLANG_PORT_FPTR_TYPE(isupper)(int);
extern CLANG_PORT_FPTR_VAR(isupper);
typedef int CLANG_PORT_FPTR_TYPE(isxdigit)(int);
extern CLANG_PORT_FPTR_VAR(isxdigit);
typedef int CLANG_PORT_FPTR_TYPE(toascii)(int);
extern CLANG_PORT_FPTR_VAR(toascii);
typedef int CLANG_PORT_FPTR_TYPE(tolower)(int);
extern CLANG_PORT_FPTR_VAR(tolower);
typedef int CLANG_PORT_FPTR_TYPE(toupper)(int);
extern CLANG_PORT_FPTR_VAR(toupper);

#ifndef __IMPL_CLANG_PORT_API_
/*
 * STD C Api.
 */
CLANG_PORT_INLINE int  isalnum(int c)
{
	return CLANG_PORT_CALL_FPTR(isalnum)(c);
}
CLANG_PORT_INLINE int  isalpha(int c)
{
	return CLANG_PORT_CALL_FPTR(isalpha)(c);
}
CLANG_PORT_INLINE int  isascii(int c)
{
	return CLANG_PORT_CALL_FPTR(isascii)(c);
}
CLANG_PORT_INLINE int  isblank(int c)
{
	return CLANG_PORT_CALL_FPTR(isblank)(c);
}
CLANG_PORT_INLINE int  iscntrl(int c)
{
	return CLANG_PORT_CALL_FPTR(iscntrl)(c);
}
CLANG_PORT_INLINE int  isdigit(int c)
{
	return CLANG_PORT_CALL_FPTR(isdigit)(c);
}
CLANG_PORT_INLINE int  isgraph(int c)
{
	return CLANG_PORT_CALL_FPTR(isgraph)(c);
}
CLANG_PORT_INLINE int  islower(int c)
{
	return CLANG_PORT_CALL_FPTR(islower)(c);
}
CLANG_PORT_INLINE int  isprint(int c)
{
	return CLANG_PORT_CALL_FPTR(isprint)(c);
}
CLANG_PORT_INLINE int  ispunct(int c)
{
	return CLANG_PORT_CALL_FPTR(ispunct)(c);
}
CLANG_PORT_INLINE int  isspace(int c)
{
	return CLANG_PORT_CALL_FPTR(isspace)(c);
}
CLANG_PORT_INLINE int  isupper(int c)
{
	return CLANG_PORT_CALL_FPTR(isupper)(c);
}
CLANG_PORT_INLINE int  isxdigit(int c)
{
	return CLANG_PORT_CALL_FPTR(isxdigit)(c);
}
CLANG_PORT_INLINE int  toascii(int c)
{
	return CLANG_PORT_CALL_FPTR(toascii)(c);
}
CLANG_PORT_INLINE int  tolower(int c)
{
	return CLANG_PORT_CALL_FPTR(tolower)(c);
}
CLANG_PORT_INLINE int  toupper(int c)
{
	return CLANG_PORT_CALL_FPTR(toupper)(c);
}

#define _tolower(x) tolower(x)
#define _toupper(x) toupper(x)

#endif /* __IMPL_CLANG_PORT_API_ */

#ifdef __cplusplus
}
#endif

#endif	/* Not _CLANG_PORT_CTYPE_H_ */

